import withRetry from '../components/ErrorBoundary/withRetry'

const menu = [
  {
    key: '/',
    icon: '',
    label: '首页',
    title: '首页',
    // component: withRetry(() => import('../views/AppMain')),
    component: withRetry(() => import('../views/AppMain')),
  },
  {
    key: '/banner',
    icon: '',
    label: '轮播图管理',
    title: '轮播图管理',
    children: [
      {
        key: '/banner/list',
        icon: '',
        label: '轮播图列表',
        title: '轮播图列表',
        component: withRetry(() => import('../views/AppBanner/AppBannerList')),
      },
      {
        key: '/banner/upload',
        icon: '',
        label: '上传轮播图',
        title: '上传轮播图',
        component: withRetry(() => import('../views/AppBanner/AppBannerUpload')),
      },
    ],
  },
  {
    key: '/pro',
    icon: '',
    label: '商品管理',
    title: '商品管理',
    children: [
      {
        key: '/pro/list',
        icon: '',
        label: '商品列表',
        title: '商品列表',
        component: withRetry(() => import('../views/AppProject/AppProjectList')),
      },
      {
        key: '/pro/filter',
        icon: '',
        label: '商品筛选',
        title: '商品筛选',
        component: withRetry(() => import('../views/AppProject/AppProjectFilter')),

      },
    ],
  },
  {
    key: '/adminuser',
    icon: '',
    label: '管理员与用户',
    title: '管理员与用户',
    children: [
      {
        key: '/adminuser/admin',
        icon: '',
        label: '管理员管理',
        title: '管理员管理',
        component: withRetry(() => import('../views/AppAdminUser')),
      },
    ],
  },
]
export const findOuterKey = (key) => {
  let result = []
  menu.forEach((item) => {
    if (item.children) {
      item.children.forEach((sitem) => {
        if (sitem.key === key) {
          result = item.key
        }
      })
    }
  })
  return [result]
}

export default menu
